home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / source / snip9503 / ll_stack.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-14  |  1.7 KB  |  40 lines

  1. /* =======================================================================
  2.     LL_STACK.h      Generic Stacks for fixed size data-items
  3.                     based on the LLS Singly Linked List module.
  4.  
  5.                     v0.50  94-08-12
  6.  
  7.                     Note that the List's current node pointer always is
  8.                     the same as its first node pointer.
  9.                     This module has no related .C file.
  10.  
  11.  _____              This version is Public Domain.
  12.  /_|__|             A.Reitsma, Delft, The Netherlands.
  13. /  | \  --------------------------------------------------------------- */
  14.  
  15. #include "lls.h"
  16.  
  17. #define LLstackCreate(itemsize)        LLScreate( itemsize )
  18. #define LLstackDelete(stack)           LLSdelete( stack )
  19.  
  20. #define LLstackPush(stack,data)        LLSnodePrepend( stack, data )
  21. #define LLstackPushFrom(stack,source)  LLSnodePrependFrom( stack, source )
  22.  
  23. #define LLstackRepair(stack)           LLSnodePtr2First( stack )
  24.           /* For 'repair' purposes and also to check for an empty Stack */
  25.  
  26. /* ---- stored data management -------------------------------------------
  27.    'return' typed data:
  28. */
  29. #define LLstackPopInt(stack)       LLSnodeInt(stack), LLSnodeDelete(stack)
  30. #define LLstackPopLong(stack)      LLSnodeLong(stack),LLSnodeDelete(stack)
  31. #define LLstackPopPtr(stack)       LLSnodePtr(stack), LLSnodeDelete(stack)
  32. #define LLstackPopFptr(stack)      LLSnodeFptr(stack),LLSnodeDelete(stack)
  33.  
  34. /* 'return' typeless data.
  35. */
  36. #define LLstackPopTo(stack,dest)   LLSnodeDataTo(stack,dest),           \
  37.                                        (dest ? LLSnodeDelete(stack) : 0 )
  38.  
  39. /* ==== LL_STACK.h  end =============================================== */
  40.